Optimal. Leaf size=297 \[ \frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}-\frac {\sqrt {-b^2} \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 b \left (a-\sqrt {-b^2}\right ) d (1+n)}+\frac {\sqrt {-b^2} \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 b \left (a+\sqrt {-b^2}\right ) d (1+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.42, antiderivative size = 297, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3647, 3728,
3712, 3566, 726, 70} \begin {gather*} \frac {\left (2 a^2-b^2 (n+2) (n+3)\right ) (a+b \tan (c+d x))^{n+1}}{b^3 d (n+1) (n+2) (n+3)}-\frac {\sqrt {-b^2} (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right )}{2 b d (n+1) \left (a-\sqrt {-b^2}\right )}+\frac {\sqrt {-b^2} (a+b \tan (c+d x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right )}{2 b d (n+1) \left (a+\sqrt {-b^2}\right )}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{n+1}}{b^2 d (n+2) (n+3)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{n+1}}{b d (n+3)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 70
Rule 726
Rule 3566
Rule 3647
Rule 3712
Rule 3728
Rubi steps
\begin {align*} \int \tan ^4(c+d x) (a+b \tan (c+d x))^n \, dx &=\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}+\frac {\int \tan (c+d x) (a+b \tan (c+d x))^n \left (-2 a-b (3+n) \tan (c+d x)-2 a \tan ^2(c+d x)\right ) \, dx}{b (3+n)}\\ &=-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}+\frac {\int (a+b \tan (c+d x))^n \left (2 a^2+\left (2 a^2-b^2 (2+n) (3+n)\right ) \tan ^2(c+d x)\right ) \, dx}{b^2 (2+n) (3+n)}\\ &=\frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}+\int (a+b \tan (c+d x))^n \, dx\\ &=\frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}+\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{b^2+x^2} \, dx,x,b \tan (c+d x)\right )}{d}\\ &=\frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}+\frac {b \text {Subst}\left (\int \left (\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}-x\right )}+\frac {\sqrt {-b^2} (a+x)^n}{2 b^2 \left (\sqrt {-b^2}+x\right )}\right ) \, dx,x,b \tan (c+d x)\right )}{d}\\ &=\frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}-\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}-x} \, dx,x,b \tan (c+d x)\right )}{2 \sqrt {-b^2} d}-\frac {b \text {Subst}\left (\int \frac {(a+x)^n}{\sqrt {-b^2}+x} \, dx,x,b \tan (c+d x)\right )}{2 \sqrt {-b^2} d}\\ &=\frac {\left (2 a^2-b^2 (2+n) (3+n)\right ) (a+b \tan (c+d x))^{1+n}}{b^3 d (1+n) (2+n) (3+n)}+\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a-\sqrt {-b^2}\right ) d (1+n)}-\frac {b \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+\sqrt {-b^2}}\right ) (a+b \tan (c+d x))^{1+n}}{2 \sqrt {-b^2} \left (a+\sqrt {-b^2}\right ) d (1+n)}-\frac {2 a \tan (c+d x) (a+b \tan (c+d x))^{1+n}}{b^2 d (2+n) (3+n)}+\frac {\tan ^2(c+d x) (a+b \tan (c+d x))^{1+n}}{b d (3+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 2.31, size = 249, normalized size = 0.84 \begin {gather*} -\frac {(a+b \tan (c+d x))^{1+n} \left (2 (i a-b) (i a+b) \left (2 a^2-b^2 \left (6+5 n+n^2\right )\right )+i (a+i b) b^3 (2+n) (3+n) \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a-i b}\right )-b^3 (i a+b) (2+n) (3+n) \, _2F_1\left (1,1+n;2+n;\frac {a+b \tan (c+d x)}{a+i b}\right )+4 a (a-i b) (a+i b) b (1+n) \tan (c+d x)-2 (a-i b) (a+i b) b^2 (1+n) (2+n) \tan ^2(c+d x)\right )}{2 (a-i b) (a+i b) b^3 d (1+n) (2+n) (3+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.34, size = 0, normalized size = 0.00 \[\int \left (\tan ^{4}\left (d x +c \right )\right ) \left (a +b \tan \left (d x +c \right )\right )^{n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \tan {\left (c + d x \right )}\right )^{n} \tan ^{4}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\mathrm {tan}\left (c+d\,x\right )}^4\,{\left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^n \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________